IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'spTemployees_RetrieveAll')
	BEGIN
		PRINT 'Dropping Procedure spTemployees_RetrieveAll'
		DROP  Procedure  spTemployees_RetrieveAll
	END

GO

PRINT 'Creating Procedure spTemployees_RetrieveAll'
GO

CREATE Procedure spTemployees_RetrieveAll
	(
		@FEMPNO char() = null, 
		@FEMPFNAME char() = null, 
		@FEMPLNAME char() = null, 
		@FEMPDEPART char() = null, 
		@FEMPEMAIL char() = null, 
		@FEMPGROUP char() = null
	)
AS
    /* 
    ------------------------------------------------------------------------------
    - Change History
    - --------------
    - Date          Description
    ------------------------------------------------------------------------------
    - 8/23/2007	Initial version created
    ------------------------------------------------------------------------------
    */
	
	SET NOCOUNT ON
	
	-- Retrieve the relevant records
	SELECT  *
	FROM	Temployees
	
	WHERE	(@FEMPNO IS NULL OR Temployees.FEMPNO = @FEMPNO)
	  AND	(@FEMPFNAME IS NULL OR Temployees.FEMPFNAME = @FEMPFNAME)
	  AND	(@FEMPLNAME IS NULL OR Temployees.FEMPLNAME = @FEMPLNAME)
	  AND	(@FEMPDEPART IS NULL OR Temployees.FEMPDEPART = @FEMPDEPART)
	  AND	(@FEMPEMAIL IS NULL OR Temployees.FEMPEMAIL = @FEMPEMAIL)
	  AND	(@FEMPGROUP IS NULL OR Temployees.FEMPGROUP = @FEMPGROUP)

	-- Return to calling method
	RETURN
GO
